<template>
  <div class="fhd">
    <!-- 这是发货单总页面 -->
    <!-- 头部样式 -->
    <div class="order_title">
      <span class="one" @click="tuihou">&lt;</span>
    </div>
    <!-- 订单第一部分内容详情 -->
    <div class="count_list">
      <ul>
        <li>
          <span>客户</span>
          <span>{{ list.cusName }}</span>
        </li>
        <li>
          <span>商品</span>
          <span>{{ list.prodName }}</span>
        </li>
        <li>
          <span>数量</span>
          <span>{{ list.prodNum }}</span>
        </li>
        <li>
          <span>下单人</span>
          <span>{{ list.orderUserName }}</span>
        </li>
        <li>
          <span>下单时间</span>
          <span>{{ list.orderTime }}</span>
        </li>
      </ul>
    </div>
    <div class="count_list2">
      <ul>
        <li>
          <span>收货人</span>
          <input type="text" v-model="userIn" />
        </li>
        <li>
          <span>联系电话</span>
          <input type="text" v-model="teleVal" />
        </li>
        <li>
          <span>收货地址</span>
          <textarea name="" id="" v-model="adressVal"></textarea>
        </li>
        <li>
          <span>物流单号</span>
          <input type="text" v-model="wuLiuDan" />
        </li>
      </ul>
    </div>
    <!-- 提交订单的按钮 -->
    <div class="cont_btn">
      <van-button type="info" size="large" @click="addcont"
        >确认发货消息</van-button
      >
    </div>
  </div>
</template>

<script>
import { GetOrderXiangQing, FaHuo } from "@/request/api";
export default {
  data() {
    return {
      // 保存的渲染的数据
      list: "",
      //   保存准备提交的参数
      userIn: "",
      teleVal: "",
      adressVal: "",
      wuLiuDan: "",
    };
  },
  created() {
    // 请求订单详情数据渲染页面;
    GetOrderXiangQing({
      serialNo: this.$route.query.id,
    }).then((res) => {
      this.list = res.data;
      console.log(this.list);
    });

    // console.log(this.$route.query.id);获取到了订单号
  },
  methods: {
    addcont() {
      console.log(this.$route.query.id);
      // 发送post请求，向后端传送收货人的信息,在点击提交按钮后。
      FaHuo({
        serialNo: this.$route.query.id,
        receiver: this.userIn,
        linkPhone: this.teleVal,
        address: this.adressVal,
        logisticsCode: this.wuLiuDan,
      }).then((res) => {
        console.log(res);
      });
    },
    tuihou() {
      this.$router.go(-1);
    },
  },
};
</script>
 
<style lang = "less" scoped>
/* 总页面布局 */
.fhd {
  min-height: 100%;
  width: 100%;
  background-color: #efefef;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 3;
}
/* ？头部样式 */
.order_title {
  width: 100%;
  height: 0.5rem;
  background-color: #003399;
  text-align: center;
  line-height: 0.5rem;
  color: white;
  font-size: 0.18rem;
  padding-top: 0.1rem;
  .one {
    float: left;
    margin-left: 0.2rem;
  }
}
/* 渲染信息的列表样式 */
.count_list {
  width: 100%;
  background-color: white;
  ul {
    li {
      height: 0.5rem;
      line-height: 0.5rem;
      padding: 0 0.15rem;
      display: flex;
      justify-content: space-between;
      border-bottom: 1px solid #eee;
      span {
        &:nth-child(2) {
          color: #aaa;
        }
      }
    }
  }
}
/* 提交信息列表样式 */
.count_list2 {
  width: 100%;
  background-color: white;
  margin-top: 0.1rem;
  ul {
    padding: 0.2rem;
    li {
      line-height: 0.25rem;
      display: flex;
      justify-content: space-between;
      padding: 0.05rem 0;
      span {
        flex: 2;
        text-align: right;
        margin-right: 0.15rem;
      }
      input {
        border: 0;
        background-color: #efefef;
        height: 0.25rem;
        flex: 10;
      }
      textarea {
        border: 0;
        background-color: #eee;
        flex: 10;
      }
    }
  }
}
/* 提交信息按钮样式 */
.cont_btn {
  position: fixed;
  bottom: 0;
  height: 0.6rem;
  width: 100%;
  background-color: white;
  padding: 0 0.2rem;
  box-sizing: border-box;
  .van-button {
    border-radius: 0.25rem;
    margin-top: 0.05rem;
  }
}
</style>